﻿
@model List<SalesOrder>

@{
    ViewBag.Title = "我的订单";
}
<div class="bs-docs-header" id="content" tabindex="-1">
    <div class="container">
        <p>发邮件给我们：<a href="mailto:minguiluo@163.com">minguiluo@163.com</a></p>
    </div>
</div>

<div class="container bs-docs-container">
    <hgroup class="title">
        <h3>@Html.Image("SalesOrder_32.png")&nbsp;@ViewBag.Title</h3>
    </hgroup>

    @if (Model.Count > 0)
    {
        var grid = new WebGrid(Model, defaultSort: "DateCreated", canSort: false, selectionFieldName: "ID");
        @grid.GetHtml(tableStyle: "table",
    headerStyle: "webgrid-header",
    footerStyle: "webgrid-footer",
    rowStyle: "webgrid-row",
    alternatingRowStyle: "webgrid-alternating-row",
    columns: grid.Columns(
    grid.Column(
        style: "webgrid-guid",
        columnName: "ID",
        header: "编号"),
    //grid.Column(
    //    style: "webgrid-numeric",
    //    columnName: "SalesLines",
    //    header: "条目数"),
    grid.Column(
        style: "webgrid-numeric",
        columnName: "Subtotal",
        header: "总金额"),
    grid.Column(
        style: "webgrid-datetime",
        columnName: "DateCreated",
        header: "创建日期"),
    grid.Column(
        style: "webgrid-datetime",
        columnName: "DateDispatched",
        header: "发货日期"),
    grid.Column(
        style: "webgrid-datetime",
        columnName: "DateDelivered",
        header: "收货日期"),
    grid.Column(
        style: "webgrid-center",
        columnName: "Status",
        header: "当前状态"),
    grid.Column(
        style: "webgrid-center",
        columnName: "Confirm",
        header: "确认收货",
        format: item => item.Status != null && item.Status == SalesOrderStatus.Dispatched ? Html.ActionLink("确认收货", "Confirm", "Home", new { id = item.ID }, new { onclick = "return confirm('请确保您已经收到了货品，否则可能财物两空。是否继续？');" }) : MvcHtmlString.Create("&nbsp;"))))
    }
    else
    {
        <div>
            <span>没有任何订单信息。</span>
        </div>
    }
</div>